
<template>
	<view>
		<!-- <view :style="{color:fontColor}"> </view> -->
		<!-- 视频播放器 -->
		<view class="zhanweiVedio flex-jc-ac">
			<video class="video" :src="videoUrl" controls v-if="ifloading===1"></video>
			<image class="jiazai-img" src="../../static/itemImg/shuaxin2.png" mode="scaleToFill"  v-if="ifloading!=1"></image>
			<!-- <image class="palyerArg-img" :src="palyerArg.pic" mode="scaleToFill"></image> -->
		</view>

		<!-- 简介、评论topbar -->
		<view class="top-bar-detail flex-js-ac">
			<view class="detail-box flex-jc-ac-col">
				<view @click="topBarCheck(1)" class="detail-text" :class="{'top-bar-select' : tobarIndex == 1}">
					简介
				</view>
			</view>

			<view class="reply-box flex-jc-ac-col">
				<view @click="topBarCheck(2)" class="reply-text" :class="{'top-bar-select' : tobarIndex == 2}">
					评论 {{total}}
				</view>
			</view>
		</view>

		<!-- 简介页数据 -->
		<view class="detail-box-2" v-show="tobarIndex == 1">
			<!-- 头像昵称等 -->
			<view class="header-box flex-jb-ac">
				<view class="flex-js-ac img-nick-box">
					<view class="img-up">
						<image :src="avatarUrl" mode="scaleToFill"></image>
					</view>
					<view class="up-data flex-as-col">
						<view class="nick-text">
							{{nickname}}
						</view>
						<view class="fans-text">
							{{fanNum}}粉丝
						</view>
					</view>
				</view>
				<!-- 关注按钮 -->
				<view @click="toguanzhu()"  class="about-btn-class flex-jc-ac">
					<view class="about-btn flex-jc-ac">
						<text class="add-class">{{gztatus}}</text>
						<text class="about-class">关注</text>
					</view>
				</view>
			</view>

			<!-- 标题以及下拉详情 -->
			<view class="title-box">
				<view class="title-class-box flex-jb-ac">
					<view class="title-text">
						<h3>{{title}}</h3>
						介绍:{{introduction}}
					</view>
					<view class="jiantou">
						<image src="../../static/itemImg/jiantou.png" mode="scaleToFill"></image>
					</view>
				</view>
			</view>

			<!-- 播放信息 -->
			<view class="player-box flex-js-ac">
				<!-- 播放量 -->
				<view class="bofang flex-jc-ac">
					<view class="icon iconfont icon-bofang">
					</view>
					<view class="bofang-number">
						{{visitCount}}
					</view>
				</view>
				<!-- 弹幕数 -->
				<view class="danmu flex-jc-ac">
					<view class="icon iconfont icon-danmu">
					</view>
					<view class="danmu-number">
						{{stat.danmaku}}
					</view>
				</view>

				<!-- 发布时间 -->
				<view class="fabu flex-jc-ac">
					{{createTime}}
				</view>

				<!-- up主昵称 -->
				<view class="upnick flex-jc-ac">
					{{nickname}}
				</view>

				<!-- 版权信息 -->
				<view class="copyright flex-jc-ac" v-show="palyerArg.copyright == 1">
					<image src="../../static/itemImg/jinzhi.png" mode="scaleToFill"></image>
					<view class="copyright-text">
						未经作者授权禁止转载
					</view>
				</view>

			</view>

			<!-- 点赞等数据 -->
			<view class="stat-box flex-jb-ac">

				<!-- 点赞 -->
				<view class="like-box flex-jc-ac-col">
					<image src="../../static/itemImg/like.png" mode="scaleToFill" @click="like"></image>
					<view class="text-class">
						{{likeCount}}
					</view>
				</view>

				<!-- 不喜欢 -->
				<view class="nolike-box flex-jc-ac-col">
					<image src="../../static/itemImg/nolike.png" mode="scaleToFill"@click="unlike"></image>
					<view class="text-class">
						<!-- 不喜欢 -->
						取消点赞
					</view>
				</view>

				<!-- 投币 -->
				<view class="bi-box flex-jc-ac-col">
					<image src="../../static/itemImg/bi.png" mode="scaleToFill"></image>
					<view class="text-class">
						{{stat.coin}}
					</view>
				</view>

				<!-- 收藏 -->
				<view class="shoucang-box flex-jc-ac-col">
					<image src="../../static/itemImg/shoucang.png" mode="scaleToFill"></image>
					<view class="text-class">
						{{stat.favorite}}
					</view>
				</view>

				<!-- 转发 -->
				<view class="share-box flex-jc-ac-col">
					<image src="../../static/itemImg/share.png" mode="scaleToFill"></image>
					<view class="text-class">
						{{stat.share}}
					</view>
				</view>

			</view>

			<view class="border-class">

			</view>

			<!-- 视频列表 -->
			<h5>为您推荐</h5>
			<scroll-view class="video-list" scroll-y>
			  <view class="video-container">
				  <view class="video-item" v-for="(item, index) in videos" :key="index">
					<image class="cover" :src="item.cover"  @click="goToPage(item.url)"></image>
					<view class="text-container" @click="goToPage(item.url)">
						<text class="title">{{item.title}}</text>
						<text class="info">{{item.info}}</text>
					</view>
				  </view>
			  </view>
			</scroll-view> -->

			<scroll-view class="video-list" scroll-y>
			  <view class="video-container">
				  <view class="video-item" v-for="(item, index) in videoList" :key="index">
					<image class="cover" :src="item.coverUrl"  @click="goToPage(item.id)"></image>
					<view class="text-container" @click="goToPage(item.id)">
						<text class="title">{{item.title}}</text>
						<text class="info">up主：{{item.user.nickname}} · {{item.visitCount}}播放 · {{item.createTime}}</text>
					</view>
				  </view>
			  </view>
			</scroll-view>


		</view>

		<!-- 评论数据 -->
		<view class="reply-box-2" v-show="tobarIndex == 2">
			<input type="text" v-model="sendmessage">
			<button type="button" @click="sendCommit">发送评论</button>
			<scroll-view class="reply-scroll-view" scroll-y="true">
				<view v-for="item in commentlist">
					<view class="item-box flex-js-ac">
						<image :src="item.user.avatarUrl" mode="scaleToFill"></image>
						<view class="nick-class">
							{{item.user.nickname}}
						</view>
					</view>
					<view class="reply-text-class">
						{{item.content}}
					</view>
					<view class="reply-text-class">
						{{item.createTime}}
						<button class="btn" style="margin-left: 170rpx;" @click="likecommit(item.id,item.isLike)">点赞{{item.likeCount}}</button>
						<button class="btn" v-if="item.user.id==inid" @click="delet(item.id)">删除</button>
					</view>
					<view class="border-class2">

					</view>
				</view>

				<view class="zhanwei-class">

				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import md5 from "../../md5.js"
	export default {
		data() {
			return {
				isFollow:false,
				inid:this.$store.state.id,
				guanzhu: 0,
				fontColor: 'red',
				gztatus:"+",

				videoList: [],
				//发送信息
				sendmessage: '',
				//视频信息
				videoId: "",
				introduction:'',
				coverUrl: '',
				videoUrl: 'https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4',
				title: '',
				visitCount: '',
				likeCount: '',
				status: '',
				createTime: '',
				//用户信息
				userid:'',
				nickname:'',
				avatarUrl:'',
				fanNum:'',
				//评论信息
				total: '',
				commentlist: [],

				videos: '',

				ifloading: 1,
				// 视频源
				videoSrc: "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4",
				cid: '',
				param: '',
				vedioUrl: '',
				tobarIndex: 1,
				palyerArg: {
					pic: "", //照片链接
					copyright: "1", //是否展示转载
					title: "标题",
					ctime: "评论100",
					desc: "描述",
					duration: "",
				},
				stat: {}, // 播放数据
				owner: {}, // up主信息
				owner_ext: {}, // 粉丝信息
				tag: [], // 标签tag
				reply: [], // 评论列表
			}
		},
		onLoad(res) {
			if(this.isFollow===true)
			{
				this.guanzhu=1;
				this.gztatus="已";
			}
			else
			{
				this.guanzhu=0;
				this.gztatus="+";
			}
			console.log("进入视频详情页——" + "视频id：" + res.id)
			console.log("进入视频详情页——" + "进入人id：" + this.inid)
			this.videoId = res.id
			this.aid = res.aid
			this.cid = res.cid
			this.param = res.param
			this.videoContext = uni.createVideoContext('myVideo')
			//console.log(res)
			//获取视频列表
			uni.request({
					method: 'GET',
					url: "http://47.97.114.13:8080/api/video/list?type=" + "&current=1&pageSize=999",
					header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					},
				})
				.then(res => {
					//console.log(res);
					console.log(res[1].data.data);
					if (res[1].data.success === true) {
						this.videoList = res[1].data.data.list

					} else {
						uni.showToast({
							title: "获取视频列表失败",
							icon: "fail"
						});
					}

				})
			//获取当前视频
			uni.request({
					method: 'GET',
					url: "http://47.97.114.13:8080/api/video/" + this.videoId,
					header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					},
				})
				.then(res => {
					//	  console.log(res);
					console.log(res[1].data.data);


					this.videoId = res[1].data.data.id;
					this.coverUrl = res[1].data.data.coverUrl;
					this.videoUrl = res[1].data.data.videoUrl;
					this.title = res[1].data.data.title;
					this.visitCount = res[1].data.data.visitCount;
					this.likeCount = res[1].data.data.likeCount;
					this.status = res[1].data.data.status;
					this.createTime = res[1].data.data.createTime;
					this.introduction = res[1].data.data.introduction;
					//用户信息
					this.userid=res[1].data.data.user.id;
					this.nickname=res[1].data.data.user.nickname;
					this.avatarUrl=res[1].data.data.user.avatarUrl;
					this.fanNum=res[1].data.data.user.fanNum;
					this.isFollow = res[1].data.data.isFollow

				  })


			if(this.videoSrc!=null)
			{
				//1为有视频源
				this.ifloading=1;
			}

			//获取评论列表
			uni.request({
				  	method:'GET',
				  	url:"http://47.97.114.13:8080/api/comment/list?page=1&pageSize=999&videoId="+this.videoId,
		  	  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					},
				  })
				  .then(res => {
			  		//		  console.log(res);
					  console.log(res[1].data.data);
					 this.total = res[1].data.data.total
					 this.commentlist = res[1].data.data.list
				  })



		},
		onPullDownRefresh(){
			if(this.isFollow===true)
			{
				this.guanzhu=1;
				this.gztatus="已";
			}
			else
			{
				this.guanzhu=0;
				this.gztatus="+";
			}
				  console.log("刷新视频详情页面")
//获取当前视频
			uni.request({
				  	method:'GET',
				  	url:"http://47.97.114.13:8080/api/video/"+this.videoId,
		  	  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
				  },
				  })
				  .then(res => {
			  			//	  console.log(res);
					  console.log(res[1].data.data);


					this.videoId=res[1].data.data.id;
					this.coverUrl=res[1].data.data.coverUrl;
					this.videoUrl=res[1].data.data.videoUrl;
					this.title=res[1].data.data.title;
					this.visitCount=res[1].data.data.visitCount;
					this.likeCount=res[1].data.data.likeCount;
					this.status=res[1].data.data.status;
					this.createTime=res[1].data.data.createTime;
					this.introduction = res[1].data.data.introduction;
					//用户信息
					this.userid = res[1].data.data.user.id;
					this.nickname = res[1].data.data.user.nickname;
					this.avatarUrl = res[1].data.data.user.avatarUrl;
										this.isFollow = res[1].data.data.isFollow

				})

			this.getCommit()
			uni.stopPullDownRefresh()
		},
		// async onShow() {
		// 	var url = this.getVideoDetilUrl(this.aid)
		// 	var obj = await this.getVideoDetil(url)
		// 	var data = obj.data.data

		// 	this.palyerArg.copyright = data.copyright
		// 	this.palyerArg.title = data.title
		// 	this.palyerArg.ctime = data.ctime
		// 	this.palyerArg.desc = data.desc
		// 	this.palyerArg.duration = data.duration
		// 	this.palyerArg.pic = data.pic

		// 	this.stat = data.stat
		// 	this.owner = data.owner
		// 	this.owner_ext = data.owner_ext
		// 	this.tag = data.tag

		// 	var createTimeMon = new Date(this.palyerArg.ctime * 1000).getMonth() + 1
		// 	var createTimeDay = new Date(this.palyerArg.ctime * 1000).getDay()

		// 	this.palyerArg.ctime = createTimeMon + "-" + createTimeDay
		// 	console.log("palyerArg-----", this.palyerArg)
		// 	console.log("stat-----", this.stat)
		// 	console.log("owner-----", this.owner)
		// 	console.log("owner_ext-----", this.owner_ext)
		// 	console.log("tag-----", this.tag)

		// 	const replyObj = await this.getReply(this.param)
		// 	this.reply = replyObj.data.data.replies
		// 	// const voideObj = await this.getVideo(this.aid, this.cid, this.param)
		// 	// const vedioUrl = voideObj.data.data.durl[0].url
		// },
		methods: {
			goToPage(id){
		uni.navigateTo({
			url: "/pages/video-detail/video-detail"+"?id="+id
		});
			},
			//发送信息
			sendCommit(){
				uni.request({
					  	method:'POST',
					  	url:"http://47.97.114.13:8080/api/comment",
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					  },
					  data:{
						 content:this.sendmessage,
						  videoId:this.videoId,
					  },
					  })
					  .then(res => {
				  				 // console.log(res);
			  		  if(res[1].data.success === true)
			  		  {
			  			  uni.showToast({
			  			    title: "提交成功",
			  			    icon: "success"
			  			  });
			  		  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "修改失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }

					  })

					  this.getCommit()
			},
			//获取评论列表
			getCommit(){
				uni.request({
					  	method:'GET',
					  	url:"http://47.97.114.13:8080/api/comment/list?page=1&pageSize=999&videoId="+this.videoId,
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					  },
					  })
					  .then(res => {
				  				 // console.log(res);
						  console.log(res[1].data.data);
						 this.total = res[1].data.data.total
						 this.commentlist = res[1].data.data.list
					  })
			},

			// 获取评论
			getReply(param){
				return new Promise( (resolve, reject) =>{
					uni.request({
						url:"https://api.bilibili.com/x/v2/reply/main?oid=" + param + "&type=1",
						success(res) {
							resolve(res)
						},
						fail(err) {
							reject(err)
						}
					})
				})
			},

			// 切换tobbar
			topBarCheck(index) {
				this.tobarIndex = index
			},
			like(){
				let that = this
				console.log(that.videoId)
				//console.log("like")
				uni.request({
					  	method:'POST',
					  	url:"http://47.97.114.13:8080/api/video/like",
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					  },
					  data:{
						 like:true,
						  id:that.videoId,
					  },
					  })
					  .then(res => {
				  				 console.log(res);
					  if(res[1].data.success === true)
					  {
						  uni.showToast({
						    title: res[1].data.data,
						    icon: "success"
						  });
					  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "点赞失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }

					  })
			},
			unlike(){
				let that = this
				//console.log("like")
				console.log(that.videoId)
				uni.request({
					  	method:'POST',
					  	url:"http://47.97.114.13:8080/api/video/like",
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
					  },
					  data:{
						 like:false,
						  id:that.videoId,
					  },
					  })
					  .then(res => {
				  				 console.log(res);
					  if(res[1].data.success === true)
					  {
						  uni.showToast({
						    title: res[1].data.data,
						    icon: "success"
						  });
					  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "点赞失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }

					  })
			},
			likecommit(id,isLike){
				//console.log("like")
				if(isLike===true)
				{
				//let that = this
				//console.log(that.videoId)
				//console.log("like")
				uni.request({
					  	method:'POST',
					  	url:"http://47.97.114.13:8080/api/comment/like",
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,	
					  },
					  data:{
						 like:false,
						  id:id,
					  },
					  })
					  .then(res => {
				  				 console.log(res);
					  if(res[1].data.success === true)
					  {
						  uni.showToast({
						    title: res[1].data.data,
						    icon: "success"
						  });
					  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "点赞失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }

					  })
				}
				else
				{
					uni.request({
						  	method:'POST',
						  	url:"http://47.97.114.13:8080/api/comment/like",
					  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
						  },
						  data:{
							 like:true,
							  id:id,
						  },
						  })
						  .then(res => {
					  				 console.log(res);
						  if(res[1].data.success === true)
						  {
							  uni.showToast({
							    title: res[1].data.data,
							    icon: "success"
							  });
						  }
						  else{
							  uni.showModal({
							  				title: "提示",
							  				content: "点赞失败："+res[1].data.message,
							  				showCancel:false,
							  				success: function (res) {
							  					if (res.confirm) {
							  						console.log('用户点击确定');
							  					} else if (res.cancel) {
							  						console.log('用户点击取消');
							  					}
							  				}
							  			});
						  }
					
						  })
				}
			},

			toguanzhu() {
				if(this.guanzhu==0)
				{
				// this.guanzhu=1;
				// this.gztatus="已";
				console.log("关注成功");
				uni.request({
					  	method:'POST',
					  	url:"http://47.97.114.13:8080/api/user/follow/"+this.userid,
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,	
					  },
					  // data:{
						 // like:true,
						 //  id:id,
					  // },
					  })
					  .then(res => {
				  				 console.log(res);
					  if(res[1].data.success === true)
					  {
						  uni.showToast({
						    title: res[1].data.message,
						    icon: "success"
						  });
					  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "关注失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }
				
					  })
				
				}
				else if(this.guanzhu==1)
				{
					// this.guanzhu=0;
					// this.gztatus="+";
					console.log("取消关注");
					uni.request({
						  	method:'POST',
						  	url:"http://47.97.114.13:8080/api/user/unfollow/"+this.userid,
					  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token,
						  },
						  // data:{
							 // like:true,
							 //  id:id,
						  // },
						  })
						  .then(res => {
					  				 console.log(res);
						  if(res[1].data.success === true)
						  {
							  uni.showToast({
							    title: res[1].data.message,
							    icon: "success"
							  });
						  }
						  else{
							  uni.showModal({
							  				title: "提示",
							  				content: "取消关注失败："+res[1].data.message,
							  				showCancel:false,
							  				success: function (res) {
							  					if (res.confirm) {
							  						console.log('用户点击确定');
							  					} else if (res.cancel) {
							  						console.log('用户点击取消');
							  					}
							  				}
							  			});
						  }
					
						  })
					
					}
				
			},
			// md5加密数据
			get_sign(params, key) {
				var s_keys = [];
				for (var i in params) {
					s_keys.push(i);
				}
				s_keys.sort();
				var data = "";
				for (var i = 0; i < s_keys.length; i++) {
					// encodeURIComponent 返回的转义数字必须为大写( 如 %2F )
					data += (data ? "&" : "") + s_keys[i] + "=" + encodeURIComponent(params[s_keys[i]]);
				}
				return {
					"sign": md5(data + key),
					"params": data
				};
			},

			//获取视频详情url
			getVideoDetilUrl(aid) {
				let paramsObj = {
					// aid: "78126101",
					aid: aid,
					appkey: "1d8b6e7d45233436",
					build: "5480400",
					ts: new Date().getTime()
				}
				let appsecret = "560c52ccd288fed045859ed18bffd973";

				let signObj = this.get_sign(paramsObj, appsecret);
				// console.log(signObj);
				let path = "https://app.bilibili.com/x/v2/view";
				let params = signObj.params;
				let sign = signObj.sign;
				let url = path + "?" + params + "&sign=" + sign;
				return url;
			},
			delet(id)
			{
				uni.request({
					  	method:'DELETE',
					  	url:"http://47.97.114.13:8080/api/comment/"+id,
				  	header: {
					  	   // "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiTk9STUFMIiwiaWQiOiIxIiwiZXhwIjoxNjkwNTMzNzQzfQ.xIb3t5ouSMjvqrrfmK2ehq5m53MhaMPtjn8kXyCeEs8",//this.$store.state.token,
					  	  "Authorization": this.$store.state.token, 
					  },
					  // data:{
						 // like:true,
						 //  id:id,
					  // },
					  })
					  .then(res => {
				  				 console.log(res);
					  if(res[1].data.success === true)
					  {
						  uni.showToast({
						    title: res[1].data.message,
						    icon: "success"
						  });
					  }
					  else{
						  uni.showModal({
						  				title: "提示",
						  				content: "删除失败："+res[1].data.message,
						  				showCancel:false,
						  				success: function (res) {
						  					if (res.confirm) {
						  						console.log('用户点击确定');
						  					} else if (res.cancel) {
						  						console.log('用户点击取消');
						  					}
						  				}
						  			});
					  }
				
					  })
			},

			// 请求视频详情网址
			getVideoDetil(url) {
				return new Promise((resolve, reject) => {
					uni.request({
						url: url,
						success(res) {
							resolve(res)
						},
						fail(err) {
							reject(err)
						}
					})
				})

			},

			// 获取视频
			getVideo(aid, cid, param) {
				console.log(param)
				return new Promise((resolve, reject) => {
					uni.request({
						url: "https://api.bilibili.com/x/player/playurl?cid=" + cid + "&avid=" + param +
							"&platform=html5&otype=json&qn=16&type=mp4&html5=1",
						success(res) {
							resolve(res)
						},
						fail(err) {
							reject(err)
						}
					})
				})
			},
		}
	}
</script>

<style>
	.zhanweiVedio {
		height: 250px;
		width: 100%;
	}
	.jiazai-img{
		width: 95rpx;
		height: 95rpx;
		position: absolute;
		top: 15%;
		left: 45%;
		z-index: 999;
		animation: spin 2s linear 100;
	}

	/* 刷新图标旋转动画 */
	@keyframes spin {
		from {
			transform: rotate(0deg);
		}

		to {
			transform: rotate(360deg);
		}
	}

	.palyerArg-img {
		width: 100%;
		height: 100%;
	}

	.top-bar-detail {
		background-color: #FFFFFF;
		height: 75rpx;
		padding-left: 65rpx;
		border-bottom: #EEEEEE 2rpx solid;
	}

	.guanzhu-bar-select {
		background-color: #EEEEEE;
	}

	.guanzhu-bar-noselect {
		background-color: #FA72B1;
	}

	.reply-box {
		margin-left: 45rpx;
	}

	.detail-text,
	.reply-text {
		font-size: 28rpx;
		padding: 0rpx 10rpx;
	}

	.top-bar-select {
		color: #FA72B1;
		border-bottom: #FA72B1 5rpx solid;
	}

	.img-up {
		height: 65rpx;
		width: 65rpx;
	}

	.img-up>image {
		height: 100%;
		width: 100%;
		border-radius: 100%;
	}

	.img-nick-box {
		margin-left: 25rpx;
		margin-top: 25rpx;
	}

	.up-data {
		margin-left: 15rpx;
	}

	.nick-text {
		font-size: 28rpx;
		font-weight: bold;
		color: #FA72B1;
	}

	.fans-text {
		font-size: 23rpx;
		color: #C0C0C0;
	}

	.about-btn-class {
		margin-right: 35rpx;
		width: 130rpx;
		height: 55rpx;
		background-color: #FA72B1;
		;

		color: #FFFFFF;
		border-radius: 5rpx;
	}

	.add-class {
		font-size: 35rpx;
	}

	.about-class {
		font-size: 25rpx;
		margin-left: 10rpx;
	}

	.jiantou {
		width: 65rpx;
		height: 65rpx;
	}

	.jiantou>image {
		width: 100%;
		height: 100%;
	}

	.title-class-box {
		padding: 0rpx 15rpx;
		margin-top: 25rpx;
	}

	.title-text {
		width: 85%;
		font-size: 28rpx;
		color: #000000;
	}

	.bofang-number,
	.danmu-number,
	.fabu,
	.upnick,
	.copyright-text {
		font-size: 20rpx;
		color: #8b8b8b;
	}

	.copyright-text,
	.danmu-number,
	.bofang-number {
		margin-left: 5rpx;
	}

	.copyright>image {
		height: 30rpx;
		width: 30rpx;
	}

	.bofang,
	.danmu,
	.fabu,
	.upnick,
	.copyright {
		margin-left: 25rpx;
	}

	.player-box {
		margin-top: 25rpx;
	}

	.stat-box {
		margin-top: 25rpx;
	}

	.like-box,
	.nolike-box,
	.bi-box,
	.shoucang-box,
	.share-box {
		flex: 1;
	}

	.like-box>image {
		height: 40rpx;
		width: 40rpx;
	}

	.nolike-box>image {
		height: 35rpx;
		width: 35rpx;
	}

	.bi-box>image {
		height: 40rpx;
		width: 40rpx;
	}

	.shoucang-box>image {
		height: 40rpx;
		width: 40rpx;
	}

	.share-box>image {
		height: 40rpx;
		width: 40rpx;
	}

	.text-class {
		margin-top: 10rpx;
		color: #8b8b8b;
		font-size: 20rpx;
	}

	.border-class {
		width: 100%;
		height: 4rpx;
		background-color: #EEEEEE;
		margin-top: 25rpx;
	}

	.reply-scroll-view {
		height: 1200rpx;
		width: 100%;
	}

	.item-box {
		margin-top: 25rpx;
	}

	.item-box>image {
		height: 65rpx;
		width: 65rpx;
		border-radius: 100%;
		margin-left: 25rpx;
	}

	.nick-class {
		color: #808080;
		font-size: 28rpx;
		font-weight: bold;
		margin-left: 15rpx;
	}

	.reply-text-class {
		display: flex;
		color: #2F2F2F;
		font-size: 25rpx;
		margin-left: 95rpx;
		margin-top: 15rpx;
	}

	.border-class2 {
		margin-top: 25rpx;
		height: 2rpx;
		width: 100%;
		background-color: #C0C0C0;
	}

	.zhanwei-class {
		height: 600rpx;
		width: 100%;
	}

	.container {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.nav {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 80rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
		background-color: #ffffff;
	}

	.logo {
		font-size: 36rpx;
		font-weight: bold;
	}

	.search-box {
		width: 80%;
		height: 60rpx;
		margin-left: 10rpx;
		margin-right: 10rpx;
		border-radius: 30rpx;
		background-color: #f0f0f0
	}

	.search-input {
		width: 100%;
		height: 60rpx;
		border: none;
		outline: none;
		padding-left: 20rpx;
		padding-right: 20rpx
	}

	.swiper {
		width: 100%;
		height: 400rpx;
	}

	.banner {
		width: 100%;
		height: 400rpx;
	}

	.category {
		display: flex;
		text-align: center;
		width: 100%;
		height: 80rpx;
		background-color: #ffffff;
		margin-top: 10rpx;
	}

	.item {
		font-size: 35rpx;
		margin: 10rpx;
		color: #999999
	}

	.active {
		color: #ff0000
	}

	.video-list {
		width: 95%;
		margin: 0 auto;
	}

	.video-container {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.video-item {
		width: 49%;
		margin-bottom: 2px;
		height: 360rpx;
	}

	.cover {
		width: 100%;
		height: 240rpx;
		border-radius: 20rpx;
	}

	.text-container {
		display: flex;
		flex-direction: column;
		padding-left: 10rpx;
		padding-right: 10rpx;
		padding-bottom: 10rpx;
	}

	.title {
		font-size: 28rpx;
		padding-left: 10rpx;
		padding-right: 10rpx
	}

	.info {
		font-size: 24rpx;
		color: #999999;
		padding-left: 10rpx;
		padding-right: 10rpx;
		padding-bottom: 10rpx
	}
	.btn{
		height: 70rpx;
		width:140rpx;
		font-size: 10rpx;
	}
</style>
